package com.chat.gateway.filter.factory;

import com.chat.gateway.filter.TestFilter;
import org.springframework.cloud.gateway.filter.GatewayFilter;
import org.springframework.cloud.gateway.filter.factory.AbstractGatewayFilterFactory;
import org.springframework.cloud.gateway.filter.factory.GatewayFilterFactory;
import org.springframework.cloud.gateway.support.AbstractConfigurable;
import org.springframework.stereotype.Component;

@Component
public class TestGatewayFilterFactory extends AbstractConfigurable<TestGatewayFilterFactory.Config> implements GatewayFilterFactory<TestGatewayFilterFactory.Config> {

    protected TestGatewayFilterFactory() {
        super(TestGatewayFilterFactory.Config.class);
    }

    @Override
    public GatewayFilter apply(Config config) {
        return new TestFilter();
    }

    //用于接收配置参数
    public static class Config {

        private String value;

        public String getValue() {
            return value;
        }

        public void setValue(String value) {
            this.value = value;
        }
    }

}
